from django.contrib.auth.models import AbstractUser
from django.db import models


class User(AbstractUser):
    """用户模型类"""
    nickname = models.CharField(max_length=20, verbose_name='昵称', null=True)
    mobile = models.CharField(max_length=11, unique=True, verbose_name='手机号')
    email = models.CharField(max_length=20, unique=True, verbose_name='邮箱', null=True)
    email_active = models.IntegerField(verbose_name='邮箱验证状态', default=0)
    user_exp = models.IntegerField(verbose_name='用户经验值', default=0)
    user_vip = models.IntegerField(verbose_name='用户VIP等级', default=0)
    user_point = models.IntegerField(verbose_name='用户商城积分', default=100)
    avatar_url = models.CharField(max_length=100, verbose_name='头像地址', null=True)

    class Meta:
        db_table = 'tb_users'
        verbose_name = '用户'
        verbose_name_plural = verbose_name
